package com.itheima.homework.uuid;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.time.LocalDateTime;
import java.util.UUID;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ServerPto {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(44444);
        ThreadPoolExecutor executor = new ThreadPoolExecutor(2,5,1, TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(3), Executors.defaultThreadFactory(),new ThreadPoolExecutor.AbortPolicy());
        while (true) {
            Socket accept = serverSocket.accept();
            executor.submit(new mothed(accept));
        }
    }
}
